﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.SessionState;

namespace AiRiZu.User.handler
{
    public class ValidateRoomConfirmInfo : IHttpHandler, IRequiresSessionState
    {
        public void ProcessRequest(HttpContext context)
        {
            int res = -1;

            string sendroomid = context.Request.Params["sendroomid"].ToString();
            string checkIn = context.Request.Params["ruzhudatevalue"].ToString();
            string checkOut = context.Request.Params["ruzhudate1value"].ToString();
            string ruzhupeoplenum = context.Request.Params["ruzhupeoplenum"].ToString();

            //检查是否输入日期
            if (checkIn.Equals("", StringComparison.Ordinal))
            {
                res = 1;
            }
            else if (checkOut.Equals("", StringComparison.Ordinal))
            {
                res = 2;
            }
            else
            {
                res = 0;
                context.Session["roomId"] = sendroomid;
                context.Session["checkIn"] = checkIn;
                context.Session["checkOut"] = checkOut;
                context.Session["ruzhupeoplenum"] = ruzhupeoplenum;
            }

            //context.Response.ContentType = "text/plain";
            context.Response.Write(res);
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}
